﻿
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Chart
{
    public class LineStyleManager
    {
        private int _index;
        private DoubleCollection _dc;
        private readonly List<SolidColorBrush> Colors = new List<SolidColorBrush> { Brushes.Red, Brushes.Blue, Brushes.Green, Brushes.Aqua, Brushes.Brown, Brushes.Fuchsia, Brushes.LawnGreen, Brushes.SteelBlue, Brushes.Orange, Brushes.Black };

        public void Reset()
        {
            _index = 0;
            _dc = null;
        }

        public void Brush(Path path)
        {
            if (_index >= Colors.Count)
            {
                _index = 0;
                _dc = new DoubleCollection { 3, 1, 2 };
            }
            path.Stroke = Colors[_index];
            if (_dc != null) path.StrokeDashArray = _dc;
            _index++;
        }
    }
}
